<%--
  Created by IntelliJ IDEA.
  User: 娅娅
  Date: 2021/6/9
  Time: 17:48
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
  <head>
    <title>办公楼门禁管理系统</title>
  </head>
  <body>
    <table>
      <tr>
        <td colspan="5" align="center"><h2>办公楼门禁管理系统</h2></td>
      </tr>
      <tr>
        <td colspan="5">
          <form>
            <table>
              <tr>
                <td>
                  持卡人姓名：<input type="text" name="userName">
                  启用状态：
                  <select name="status">
                    <option>--全部--</option>
                    <option value="1">启用</option>
                    <option value="0">禁用</option>
                  </select>
                  &nbsp;
                  <input type="submit" value="查询">
                  &nbsp;
                  <a href="add.jsp"><button>办卡</button></a>
                </td>
              </tr>
            </table>
          </form>
        </td>
      </tr>
      <tr>
        <th><strong>持卡人姓名</strong></th>
        <th><strong>持卡人身份证号</strong></th>
        <th><strong>启用状态</strong></th>
        <th><strong>办卡日期</strong></th>
        <th><strong>操作</strong></th>
      </tr>
      <c:forEach var="card" items="${list}" varStatus="c">
        <tr <c:if test="${c.index % 2==0}">style="background: antiquewhite" </c:if>>
          <td>${card.userName}</td>
          <td>${card.idNumber}</td>
          <td>${card.status==0?"禁用":"启用"}</td>
          <td>${card.createDate}</td>
          <td>
            <a href="UpdateServlet?id=${card.id}&status=${card.status}">${card.status==0?"启用":"禁用"}</a>
            &nbsp;
            <a href="DelServlet?id=${card.id}">删除</a>
            <a href="DetailsServlet?idNumber=${card.idNumber}">详情</a>
          </td>
        </tr>
      </c:forEach>
    </table>
    <p style="color: lawngreen">${info}</p>
    <p>
      <a href="ListServlet?pageNo=${pageNo}">首页</a>
      <c:if test="${pageNo>1}">
        <a href="ListServlet?pageNo=${pageNo-1}">上一页</a>
      </c:if>
      <a href="ListServlet?pageNo=${pageNo+1}">下一页</a>
    </p>
  </body>
</html>
